package Utils;

import java.util.StringTokenizer;

public class Matrix {

    public static String write(int A[][]) {
        StringBuffer s = new StringBuffer();
        for (int[] aA : A) s.append(Util.writeArray(aA)).append(" ");
        return s.toString();
    }

    public static void read(String s, int A[][]) {
        StringTokenizer st = new StringTokenizer(s);
        for (int i = 0; i < A.length; i++) {
            for (int j = 0; j < A[i].length; j++)
                A[i][j] = Integer.parseInt(st.nextToken());
        }
    }

    public static void setZero(int A[][]) {
        for (int i = 0; i < A.length; i++)
            for (int j = 0; j < A[i].length; j++)
                A[i][j] = 0;
    }

    public static void setMax(int A[][], int B[][]) {
        for(int i = 0; i < A.length; i++)
            for (int j = 0; j < A[i].length; j++)
                A[i][j] = Util.max(A[i][j],B[i][j]);
    }

}
